/* Copyright ©, 2022, ECARX (Hubei) Technology Co., Ltd. All rights reserved.
 *
 * NOTICE: This file contains information which is confidential and proprietary to ECARX
 * (Hubei) Technology Co., Ltd. and/or other developers. No license to any intellectual
 * property rights contained within this file is either granted or implied except as may be
 * provided in an agreement with ECARX (Hubei) Technology Co., Ltd.
 *
 * Any unauthorized copying or distribution of content from this file in whole or in part
 * is prohibited.
 */
#ifndef ECARX_VHAL_CORE_VENDOR_SERVICE_INTERFACE_H
#define ECARX_VHAL_CORE_VENDOR_SERVICE_INTERFACE_H

#include <android/hardware/automotive/vehicle/2.0/types.h>

#include <functional>

namespace ecarx::vhal::core::interface {
using VehiclePropConfig = android::hardware::automotive::vehicle::V2_0::VehiclePropConfig;
using VehiclePropValue = android::hardware::automotive::vehicle::V2_0::VehiclePropValue;

struct ConfigDeclaration {
    VehiclePropConfig config;

    /* This value will be used as an initial value for the property. If this field is specified for
     * property that supports multiple areas then it will be used for all areas unless particular
     * area is overridden in initialAreaValue field. */
    VehiclePropValue::RawValue initialValue;
    /* Use initialAreaValues if it is necessary to specify different values per each area. */
    std::map<int32_t, VehiclePropValue::RawValue> initialAreaValues;
};
class IVendorVehicleServer {
  public:
    using VehiclePropValue = ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue;
    using HalServerCommit = std::function<void(const VehiclePropValue&)>;
    virtual std::vector<ConfigDeclaration> onGetAllPropertyConfig() const = 0;
    virtual void onSetProperty(const VehiclePropValue&) = 0;
    virtual bool isSupported(int32_t propId) = 0 ;
    virtual void registerUpdateCallback(const HalServerCommit&&) = 0;
    virtual bool dump(const int fd,
                      const android::hardware::hidl_vec<android::hardware::hidl_string>& options) = 0;
    virtual ~IVendorVehicleServer() {}
};
}  // namespace ecarx::vhal::core::interface

#endif
